import java.util.Scanner;
import java.util.InputMismatchException;

public class Main5 {
    public static void main(String[] args) {
        int[] a = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

        Scanner sc = new Scanner(System.in);

        int n =0;
        try{
            int t=sc.nextInt();
            n = t;
        }catch(InputMismatchException ex){
            System.out.println("catch a InputMismatchException");
            System.exit(0);
        }
        sc.nextLine();
        for(int i =0;i<n;i++){
            try{
                int index = sc.nextInt();
                int ret = 1/a[index];
                System.out.println(ret);
            }catch(InputMismatchException ex){
                System.out.println("catch a InputMismatchException");
                sc.nextLine();
            }catch(ArrayIndexOutOfBoundsException ex){
                System.out.println("catch a ArrayIndexOutOfBoundsException");
                sc.nextLine();
            }catch(ArithmeticException ex){
                System.out.println("catch a ArithmeticException");
                sc.nextLine();
            }
        }

        sc.close();
    }
}


